package pojo.Homework

object MyClass05 {
  def main(args: Array[String]): Unit = {
    val student5: Student5 = new Student5("赵敏", 20)
    val student5_2: Student5 = new Student5("北京")
    println(student5.name)
    println(student5.age)
    println(student5_2.address)
  }

  class Student5(var name: String = "张无忌", var age: Int = 25, var address: String = null) {
    println("student5主构造器初始化")

    def this(name: String, age: Int) {
      this()
      this.name = name
      this.age = age
      println("student5调用第一个辅助构造方法")
    }

    def this(address: String) {
      this()
      this.address = address
      println("student5调用第二个辅助构造方法" + address)

    }
  }


}

